blob: c625057f89495ff5908c296fc9ed2987b0cd9bc6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
---
import { type CollectionEntry, getCollection } from "astro:content";
import Comments from "../../components/Comments.astro";
import Layout from "../../layouts/BaseLayout.astro";
import dayjs from "dayjs";
type Props = CollectionEntry<"blog">;
export async function getStaticPaths() {
const posts = await getCollection("blog", ({ data }) => {
return data.draft !== true;
});
return posts.map((post) => ({
params: { slug: post.slug },
props: post,
}));
}
const post = Astro.props;
const { Content, remarkPluginFrontmatter } = await post.render();
const date = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY");
const title = `${post.data.title} | Valentin Popov`;
const description = post.data.description;
const lang = post.data.lang;
---
<style lang="scss">
@use "../../scss/variables" as *;
p {
opacity: 0.5;
}
</style>
<Layout title={title} description={description} lang={lang}>
<article>
<section>
<h1>{post.data.title}</h1>
</section>
<section>
<p>
<small>
Posted
<time datetime={post.data.pubDate.toISOString()} lang="en">{date}</time>
by {post.data.author}
<span> • </span>
<span>{remarkPluginFrontmatter.minutesRead}</span>
</small>
</p>
</section>
<section>
<Content />
</section>
<section>
<Comments />
</section>
</article>
</Layout>
|